import axios from '@/utils/request'
/**
 * 获取用户的频道列表
 * @returns
 */
export const getChannels = () => {
  return axios({
    url: '/v1_0/user/channels'
  })
}
/**
 * 获取所有频道
 * @returns
 */
export const getAllChannels = () => {
  return axios({
    url: '/v1_0/channels'
  })
}
/**
 *  设置用户频道存储到服务器
 * @param {*} channels  传递的参数id
 * @returns
 */
export function setUserChannel(channels) {
  return axios({
    method: 'PATCH',
    url: '/v1_0/user/channels',
    data: {
      channels
    }
  })
}
/**
 * 指定删除用户频道
 * @param {删除频道的id}} target
 * @returns
 */
export function delUserChannel(target) {
  return axios({
    method: 'DELETE',
    url: `/v1_0/user/channels/${target}`
  })
}
